package com.xjd.edu.admin.controller;

import com.xjd.edu.admin.service.ValidateCodeService;
import com.xjd.edu.common.ResultV2;
import com.xjd.edu.common.exception.CaptchaException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("/system/validate")
public class ValidateCodeController {

    @Autowired
    private ValidateCodeService ValidateCodeService;

    @RequestMapping("/code")
    public ResultV2 list() throws IOException, CaptchaException {
        Map<String, Object> captchaMap = ValidateCodeService.createCaptcha();
        return ResultV2.successData(captchaMap);
    }
}
